/*
 * Copyright 2012 ITC Tsinghua University. All Rights Reserved.
 */
package cn.edu.tsinghua.cic.ccss.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.forten.core.entity.rdb.hibernate.HibernateEntityWithCurrentTimeId;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 
 * 
 * @author <a href="mailto:du_yi@bbn.cn">Duyi</a>
 * 
 * @since 2012-5-14
 */
@Entity
@Table(name = "THRS_GBGL_XKXXB")
@Cache(region = "courseCanceledCache", usage = CacheConcurrencyStrategy.READ_WRITE)
public class CourseSelection extends HibernateEntityWithCurrentTimeId {
	private static final long serialVersionUID = 8503850975161239047L;

	@Column(name = "KC_ID")
	private long courseId;// 课程ID
	@Column(name = "GB_ID")
	private long cadreId;// 干部ID
	@Column(name = "XKCZSJ")
	private Date selectTime;// 选课操作时间
	@Column(name = "XKCZR")
	private String selectCardId;// 选课操作人工作证号
	@Column(name = "SKZT")
	private String state;// 上课状态
	@Column(name = "SKZTSM")
	private String stateExplanation;// 上课状态说明
	@Column(name = "yscgzzh")
	private String deletedCardNum = "0";
	@Column(name = "BZ")
	private String memo;// 备注
	@Column(name = "DXQD")
	private String resultOfShortMsgSign; // 短信签到结果

	public CourseSelection() {
		super();
		this.state = "0";
	}

	public long getCourseId() {
		return courseId;
	}

	public void setCourseId(long courseId) {
		this.courseId = courseId;
	}

	public long getCadreId() {
		return cadreId;
	}

	public void setCadreId(long cadreId) {
		this.cadreId = cadreId;
	}

	public Date getSelectTime() {
		return selectTime;
	}

	public void setSelectTime(Date selectTime) {
		this.selectTime = selectTime;
	}

	public String getSelectCardId() {
		return selectCardId;
	}

	public void setSelectCardId(String selectCardId) {
		this.selectCardId = selectCardId;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getStateExplanation() {
		return stateExplanation;
	}

	public void setStateExplanation(String stateExplanation) {
		this.stateExplanation = stateExplanation;
	}

	/**
	 * @return the deletedCardNum
	 */
	public String getDeletedCardNum() {
		return deletedCardNum;
	}

	/**
	 * @param deletedCardNum
	 *            the deletedCardNum to set
	 */
	public void setDeletedCardNum(String deletedCardNum) {
		this.deletedCardNum = deletedCardNum;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getResultOfShortMsgSign() {
		return resultOfShortMsgSign;
	}

	public void setResultOfShortMsgSign(String resultOfShortMsgSign) {
		this.resultOfShortMsgSign = resultOfShortMsgSign;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + (int) (cadreId ^ (cadreId >>> 32));
		result = prime * result + (int) (courseId ^ (courseId >>> 32));
		result = prime * result
				+ ((deletedCardNum == null) ? 0 : deletedCardNum.hashCode());
		result = prime * result + ((memo == null) ? 0 : memo.hashCode());
		result = prime
				* result
				+ ((resultOfShortMsgSign == null) ? 0 : resultOfShortMsgSign
						.hashCode());
		result = prime * result
				+ ((selectCardId == null) ? 0 : selectCardId.hashCode());
		result = prime * result
				+ ((selectTime == null) ? 0 : selectTime.hashCode());
		result = prime * result + ((state == null) ? 0 : state.hashCode());
		result = prime
				* result
				+ ((stateExplanation == null) ? 0 : stateExplanation.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		CourseSelection other = (CourseSelection) obj;
		if (cadreId != other.cadreId)
			return false;
		if (courseId != other.courseId)
			return false;
		if (deletedCardNum == null) {
			if (other.deletedCardNum != null)
				return false;
		} else if (!deletedCardNum.equals(other.deletedCardNum))
			return false;
		if (memo == null) {
			if (other.memo != null)
				return false;
		} else if (!memo.equals(other.memo))
			return false;
		if (resultOfShortMsgSign == null) {
			if (other.resultOfShortMsgSign != null)
				return false;
		} else if (!resultOfShortMsgSign.equals(other.resultOfShortMsgSign))
			return false;
		if (selectCardId == null) {
			if (other.selectCardId != null)
				return false;
		} else if (!selectCardId.equals(other.selectCardId))
			return false;
		if (selectTime == null) {
			if (other.selectTime != null)
				return false;
		} else if (!selectTime.equals(other.selectTime))
			return false;
		if (state == null) {
			if (other.state != null)
				return false;
		} else if (!state.equals(other.state))
			return false;
		if (stateExplanation == null) {
			if (other.stateExplanation != null)
				return false;
		} else if (!stateExplanation.equals(other.stateExplanation))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "CourseSelection [courseId=" + courseId + ", cadreId=" + cadreId
				+ ", selectTime=" + selectTime + ", stateExplanation="
				+ stateExplanation + ", deletedCardNum=" + deletedCardNum
				+ ", memo=" + memo + ", resultOfShortMsgSign="
				+ resultOfShortMsgSign + "]";
	}
	
}
